﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Home/Home.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Heritage.Models" %>
<%@ Import Namespace="Heritage.Codebox" %>
<asp:Content ID="Content" ContentPlaceHolderID="MainContent" runat="server">
<%
    PersonalModel model = ViewData.Model as PersonalModel;%>

<div style="padding-top:0px;">
<div class="mainname">
    <div style="float:left;padding-top:12px;"><span class="FreeSetBold" style="padding-left: 30px; padding-bottom: 0px; margin-top:0px; color:#0E1A21; font-size:20px;">Мафиози по кличке <%=model.Username%></span></div>
    <div style="float:right; padding-top:7px; padding-right:10px;"><%=model.Icons%></div>
</div>

<div style="margin-bottom:25px;padding-bottom:0px;">

    <div class="photo" style="position:absolute;">
        <%
    if (model.Username == Utils.GetCurrentUser().Username)
    {%><span style="float:right;position:absolute;top:-15px;right:0px;"><a href="#" onclick="$('#cooldiv').dialog({ modal: true });" class="myhref" style="text-decoration:underline !important;font-size:10px;">обновить фото</a></span> <%
    }%>
        <img src="/Home/Photo/<%=model.UserID%>"/>
    </div>
    <div class="personal">        
        <div class="infoheader" style="margin-bottom:8px;">Личная информация
        <%
    if (model.Username == Utils.GetCurrentUser().Username)
    {%><span style="float:right;"><a href="/Home/EditInfo" class="myhref" style="text-decoration:underline !important;font-size:10px;position:relative;top:-20px;left:20px;">редактировать</a></span> <%
    }%>
        </div>
        <div style="width:100%;">
        <table style="width:100%; font-size:11px;color:#6B562C" cellspacing="0">
        <tr><td class="infoline" style="white-space:nowrap;">Также известен как:</td><td class="infoline" width="100%"><b><%=model.GameNicks%></b></td></tr>
        <tr><td class="infoline" style="white-space:nowrap;">Скрывается в:</td><td class="infoline"><b><%=model.City%></b></td></tr>
        <tr><td class="infoline" style="white-space:nowrap;">Дата рождения:</td><td class="infoline"><b><%=model.Birthdate%></b></td></tr>
        <tr><td class="infoline" style="white-space:nowrap;">В игре с:</td><td class="infoline"><b><%=model.Since%></b></td></tr>
        <tr><td class="infoline padded" style="white-space:nowrap;">Сыграно игр:</td><td class="infoline padded"><b><%=model.Played%></b></td></tr>
        <tr><td class="infoline padded" colspan="2"><b>Выходит на контакт по явкам:</b></td></tr>
        <tr><td class="infoline" style="white-space:nowrap;">E-mail:</td><td class="infoline"><b><%=model.ContactMail%></b></td></tr>
        <tr><td class="infoline" style="white-space:nowrap;">ICQ:</td><td class="infoline"><b><%=model.ICQ%></b></td></tr>
        <tr><td class="infoline padded stroked" style="white-space:nowrap;">Skype:</td><td class="infoline padded stroked"><b><%=model.Skype%></b></td></tr>
        <%
    double rating = 0;
    double.TryParse(model.PersonalRating, out rating);
    int tranlen = (int) (rating/5*80);
    int opqlen = 80 - tranlen;
%>
        <tr><td class="infoline" style="white-space:nowrap;"><div style="float: left;padding-top:2px;">Персональный рейтинг:&nbsp</div></td><td class="infoline"> <div style="float: left; width:81px; height:16px; overflow:hidden; background-image:url('/images/icons/16/stars.png');"><img src="/images/icons/16/transp.png" height="16px" width="<%=tranlen%>px" style="margin:0px 0px 0px 0px; padding:0px 0px 0px 0px;"><img src="/Images/Icons/16/opaq.png" height="16px" width="<%=opqlen%>px" alt="q" style="margin:0px 0px 0px 0px; padding:0px 0px 0px 0px; z-index:9999"></div><div style="float:left; position:relative;top:-2px; font-weight:bold">&nbsp;<sup>(<%=model.PersonalRating%>)</sup></div><div class="clear"></div>
        </td></tr>
        <tr><td class="infoline" style="white-space:nowrap;"><div style="float:left;padding-top:2px;">Игровой рейтинг:&nbsp;</div></td><td class="infoline"><%=Utils.GetServerStars(model.ServerRating)%><div class="clear"></div>
        </td></tr>
        </table>
        </div>
    </div>

    </div>
    <div class="aboutself">
        <div class="infoheader">Выписка из личного дела</div>
        <div style="padding-left:20px;padding-right:20px;padding-top:20px;font-size:14px;color:#6B562D;text-align:center">
        <%=model.About%>
        </div>
    
<%--       <div class="gamename" style="margin-left:0px; font-weight:normal !important;">Выписка из личного дела</div>
       <div class="gamedesc" style="background-color:#EFE7D8 !important; margin-left:0px;padding: 20px 30px 20px 30px; text-align:center; color:#6B562C; font-size:13px !important;">
        <%=model.About %>
        </div>--%>

    </div>
    <div class="feedback">
        <div class="infoheader">Отзывы соратников
        <%
    if (model.UserID != Utils.GetCurrentUser().ID.ToString("N"))
    {%>
        <div style="float:right; font-size:x-small; position:relative; top:-16px;right:-20px;"><a href="#" onclick="$('#fdbk').show();return false;" class="myhref" style="text-decoration:underline !important">оставить отзыв</a></div>
        <%
    }%>
        </div>
        <div style="padding-left:20px;padding-right:20px; padding-top:6px; padding-bottom: 20px;font-size:11px;color:#6B562D; display:none" id="fdbk">
        <form name="fbform" method="post" action="/Home/PersonalFeedback">
        <input type="hidden" name="userid" value="<%=model.UserID%>" />
        <input type="checkbox" name="private" />&nbsp;<b>Приватный отзыв</b><br />
        <textarea style="width:100%; height:160px;" name="fbtext"></textarea><br /><br />
        <a href="#" class="awesome" onclick="document.fbform.submit(); return false;">Отправить</a>&nbsp;
        <a href="#" class="awesome" onclick="$('#fdbk').hide(); return false;">Закрыть</a> 
        </form>
        </div>
        <%
        SocialMessagePack feedbacks = Utils.GetFeedbacks(model.UserID, Request["fbpage"]);
        if (feedbacks.AllPages == 0)
        {
        %>
        <div style="padding-left:20px;padding-right:20px;padding-top:20px;font-size:14px;color:#6B562D; text-align:center">
        Отзывов пока нет
        <br /><br /></div>
        <%
}
        else
        {
            %>
            <div style="color:#6B562D;padding-bottom:0px; margin-left:20px; font-size:12px; font-weight: bold">
            Страницы:&nbsp;
            <% for (int i = 1; i <= feedbacks.AllPages; i++)
            {%>
                <a class="myhref2" href="/Home/Personal/<%=model.UserID %>?fbpage=<%=i %>">[<%=i %>]</a>&nbsp; 
            <%
            }%>
            </div>
            <%
                foreach (var socialMessagese in feedbacks.MessagesPage)
                { %>
        <div class="gamename" style="margin-top:16px;">Отзыв от пользователя <a class="myhref" href="/Home/Personal/<%=socialMessagese.MsgFrom %>"><%=Utils.GetUserByID(socialMessagese.MsgFrom.ToString("N")).Username%></a><div style="float:right;"><%=socialMessagese.MsgDate.ToString("dd.MM.yyyy")%></div></div>
        <div class="gamedesc">
        <table>
        <tr><td valign=top>
        <div class="smallphoto">
        <a class="myhref" href="/Home/Personal/<%=socialMessagese.MsgFrom %>"><img src="/Home/SmallPhoto/<%=socialMessagese.MsgFrom.ToString("N") %>" /></a>
        </div>
        <span style="font-weight:bold; font-size:14px;"><a class="myhref" href="/Home/Personal/<%=socialMessagese.MsgFrom %>"><%=Utils.GetUserByID(socialMessagese.MsgFrom.ToString("N")).Username%></a></span><br />
        <span style="font-weight:normal; font-size:10px;color:#aaa"><%=socialMessagese.MsgDate.ToString("dd.MM.yyyy")%></span>
        </td><td valign="top" width="100%">

        <div style="padding-left:30px; color:#6B562D; font-size:small;">
        <% if (socialMessagese.MsgType == Constants.SOCIALMESSAGE_TYPE_PERSONAL_FEEDBACK_PUBLIC || socialMessagese.MsgFrom == Utils.GetCurrentUser().ID || socialMessagese.MsgTo == Utils.GetCurrentUser().ID)
           {
               if (socialMessagese.MsgType == Constants.SOCIALMESSAGE_TYPE_PERSONAL_FEEDBACK_PRIVATE)
               {%>
                 <span style="font-size:x-small; font-weight:bold; color:red">Приватный отзыв!<br /><br /></span>  
               <%}
               
               %>
        <%=socialMessagese.MsgText%>
        <%
                }
           else
           {%>
           <i style="color:#f00">Этот отзыв приватный и доступен только адресату и отправителю</i>
<%
                }%>
        </div>
        </td></tr>
        </table>
        </div>
        
  
        <%    }
        }%>
    </div>
</div>

<div id="cooldiv" title="Загрузка фотографии" style="display:none;">        
    <form name="upload" method="post" enctype="multipart/form-data" action="/File/Upload">
    <br />
        <p><input type="file" id="fileUpload" name="file" size="30"/></p>
        <a href="#" class="awesome" onclick="document.upload.submit();return false;">Загрузить</a>
        </form>
</div>


</asp:Content>
